package com.leetao.demo;

import com.leetao.dingtalk.core.domain.MessageCorpconversation;
import com.leetao.dingtalk.core.domain.Token;
import com.leetao.dingtalk.core.domain.rest.Rest;
import com.leetao.dingtalk.core.service.DingTalkAuthService;
import com.leetao.dingtalk.core.service.DingTalkNotificationService;
import com.taobao.api.ApiException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * 钉钉demo
 * @author 菅江晖
 * @date 2021/5/24 - 14:06
 */
@SpringBootTest
public class DingTalkDemo {

    @Autowired
    private DingTalkAuthService dingTalkAuthService;

    @Autowired
    private DingTalkNotificationService dingTalkNotificationService;

    @Test
    public void getToken() throws ApiException {
        Rest<Token> token = dingTalkAuthService.getToken();
        System.out.println(token);
    }

    @Test
    public void sendMsg() throws ApiException {
        Rest<MessageCorpconversation> msg = dingTalkNotificationService.sendJobNotificationTextMessagesToDeptIds("Java demo","469826263","469929146");
        System.out.println(msg);
    }


}
